#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2019 crane <crane@gosun>
#
# Distributed under terms of the MIT license.

"""

"""

def fib(n):
    # print("[enter calc fib ", n)

    # if n == 0:
    #     return 0
    # if n == 1:
    #     return 1

    # TODO: optimize me!!!

    if n in {0, 1}:
        ret = n
    else:
        ret = fib(n-1) + fib(n-2)
    # print(" exit calc fib %s ]" % n)
    return ret


def main():
    print("start main")

    # print(fib(2))
    # print(fib(3))
    # print(fib(10))
    print(fib(40))

if __name__ == "__main__":
    main()
